#ifndef __BRIDGE_CONNECTOR__
#define __BRIDGE_CONNECTOR__

#include "cocos2d.h"
#include "LuaPacket.h"

using namespace std;

class LuaConnector : public cocos2d::Ref
{
public:
	LuaConnector(WORD  wConnectID);
	virtual ~LuaConnector();

	static LuaConnector * GetInstance(WORD  wConnectID = 0);
	void Connect(const char* ip, int port);
	void CloseSocket();
	WORD SendData(WORD wMainCmdID, WORD wSubCmdID);
	WORD SendData(UINT16 wMainCmdID, WORD wSubCmdID, LuaPacket* packet);

	WORD GetConnectID();
	WORD GetConnectState();
	void DoNetworkConnect(WORD wConnectID);

private:
	void  OnReceiveData(float dt);
	
	
	static LuaConnector * m_pLuaConnector;
	WORD  m_wConnectID;

   
};

#endif /* defined(__BRIDGE_CONNECTOR__) */
